import java.util.Random;
import java.util.Date;

public class Dice {

	private int sides;
	private int number;

	public Dice() {
	  this.sides = 0;
	  this.number = 0;
	}
	
	public int getSides() {
		return sides;
	}

	public boolean setSides(int sides) {
	  if(sides < 0) {
	    System.out.println("Error: Invalid dice sides " + sides);
	    return false;
	  }
		this.sides = sides;
		return true;
	}
	
	public int getNumber() {
	  return number;
	}
	
	public void setNumber(int num) {
	  this.number = num;
	}
	
	public int roll() {
	  if(this.sides <= 0) return 0;
	  
	  Random generator = new Random();
	  this.number = generator.nextInt(this.sides) + 1;
	  return this.number;
	}
	
}
